import re

# 点 符号 匹配任意符号; 除了\n

one = """afdsfdsfd
         
         sfdsfddfL"""

# 默认 正则python 贪婪模式
re_str = "a(.*)L"

# 查找所有符合正则的数据
# result = re.findall(re_str,one,re.S)
result = re.findall(re_str,one,re.DOTALL)
print(result)
print('>' * 20)


# 范围 [ ]


two = "13569829191"

# 取 1或者9
re_two = '[1,9]'

# 取反  除了谁之外的内容
re_thre = '[^1]'

result = re.findall(re_two,two)
print(result)
result = re.findall(re_thre,two)
print(result)
print('>' * 20)


# "^[a-zA-Z]\w{4,9}$"
# ^$ 从开头到结尾匹配
# [a-zA-Z]大小写字母任意
# \w 数字字母下划线
# 4-9次

four = "^[a-zA-Z]\w{4,9}$"

four_str = "a1234"
result = re.match(four,four_str)
print(result.group())
print('>' * 20)


# 手机号的正则

telephone =  "^1[35678]\d{9}$"
number = "15436578923"

result = re.match(telephone,number)
print(result.group())
